package cn.itcast.spring.demo4;

import static org.junit.Assert.*;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class PropertyTest {

	@Test
	public void getPerson() throws Exception {
		ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
		Person bean = (Person) context.getBean("person");
		Dog dog = bean.getDog();
		System.out.println("狗的年龄是"+dog.getAge());
		System.out.println(bean.toString());;
	}
	
	
	
	
	@Test
	public void testPproperty() throws Exception {
		ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
		Person bean = (Person) context.getBean("person2");
		System.out.println(bean.toString());
	}
	
	
	//spring的spel表达式语言
	@Test
	public void getPersonAge() throws Exception {
		ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
		Person bean = (Person) context.getBean("personAge");
		System.out.println(bean.toString());
	}
	
	
}
